import { SUPPLIER_CATEGORY_SELECT_LIST } from '@/pages/supplier/constants/common'
import { list2Obj } from '@/pages/supplier/utils';
import { INSPECTION_CLASSIFY_OPTIONS, SUPPLIER_CLASSIFY_OPTIONS, INSPECTION_STATE_OPTIONS } from '../../constants'
// 待考察供应商列表
const FORM_ITEM_LIST = [
  {
    prop: 'supplierCode',
    label: '供应商代码',
    type: 'input'
  },
  {
    prop: 'supplierName',
    label: '供应商名称',
    type: 'input',
  },
  {
    prop: 'supplierClassify',
    label: '供应商分类',
    type: 'select',
    clearable: true,
    options: SUPPLIER_CLASSIFY_OPTIONS,
  },
  {
    prop: 'inspectionState',
    label: '考察状态',
    type: 'select',
    options: INSPECTION_STATE_OPTIONS,
  },
  {
    prop: 'mainCategoryId',
    label: '主营品类',
    type: 'categorySelect',
  },
  { prop: 'managementAreaId', label: '管理区域', type: 'managementArea' },
  { prop: 'belongDepartment', label: '归属中心', type: 'select', clearable: true, dict: 233 },
  { prop: 'businessContactName', label: '业务对接人', type: 'input' },
  { prop: 'inspectionPersonName', label: '考察人', type: 'input' },
  { prop: 'inspectCycle', label: '考察周期', type: 'select', clearable: true, dict: 234 },
  {
    prop: 'inspectionClassify',
    label: '考察分类',
    type: 'select',
    options: INSPECTION_CLASSIFY_OPTIONS,
  },
  { prop: 'pushTime', label: '推送待办时间', type: 'datePicker', valueFormat: 'yyyy-MM-dd' },
  { prop: 'endTime', label: '待办截至时间', type: 'datePicker', valueFormat: 'yyyy-MM-dd' },
]
const initTableColumns = (parent) => {
  return [
    {
      title: '供应商代码',
      key: 'supplierCode'
    },
    {
      title: '供应商名称',
      key: 'supplierName',
      /* render: (h, { row }) => {
        return <el-link onClick={() => parent.handleViewSupplierDetial(row) }>{ row.supplierName }</el-link>;
      } */
    },
    {
      title: '供应商分类',
      key: 'supplierClassify',
      formatter: (row, columns, cellValue) => {
        return list2Obj(SUPPLIER_CATEGORY_SELECT_LIST)[cellValue]
      }
    },
    {
      title: '待办截止时间',
      key: 'endTime'
    },
    {
      title: '主营品类代码',
      key: 'mainCategoryCode'
    },
    {
      title: '主营品类',
      key: 'mainCategory'
    },
    {
      title: '供应商管理区域',
      key: 'supplierManagerAreaName'
    },
    {
      title: '供应商归属中心',
      key: 'belongDepartmentName'
    },
    {
      title: '本年进货额',
      key: 'yearPurchaseAmount'
    },
    {
      title: '业务对接人',
      key: 'businessContactName'
    },
    {
      title: '考察人',
      key: 'inspectionPersonName'
    },
    {
      title: '制单人',
      key: 'voucherPersonName'
    },
    {
      title: '考察周期',
      key: 'inspectCycleName'
    },
    {
      title: '考察分类',
      key: 'inspectionClassifyName'
    },
    {
      title: '考察状态',
      key: 'inspectionStateName'
    },
    {
      title: '推送待办时间',
      key: 'pushTime'
    },
  ]
}
const RECORD_TABLE_COLUMNS = [
  {
    title: '接受部门',
    key: 'sendingDepartment'
  },
  {
    title: '接受人员',
    key: 'sendingPersonName'
  },
  {
    title: '转派说明',
    key: 'redeployExplain'
  },
  {
    title: '转派人',
    key: 'redeployName'
  },
  {
    title: '转派时间',
    key: 'redeployTime'
  }
]
export {
  FORM_ITEM_LIST,
  initTableColumns,
  RECORD_TABLE_COLUMNS
}
